DBMS
🔑 PART 1: KEYS IN DBMS (MOST SCORING)
🔹 What is a Key?
👉 A key is an attribute (or set of attributes) that uniquely identifies a record in a table.
🧠 Memory Trick:
“S C P F A” → Super, Candidate, Primary, Foreign, Alternate
🔹 Types of Keys (Exam Favorite)
| Key | Meaning | Easy Example |
|---|---|---|
| Super Key | Can uniquely identify record | RollNo, (RollNo + Name) |
| Candidate Key | Minimal Super Key | RollNo |
| Primary Key | Chosen candidate key | RollNo |
| Alternate Key | Candidate key not chosen | Aadhaar |
| Foreign Key | Refers to PK of another table | DeptID |
| Composite Key | More than one attribute | (RollNo + Subject) |
📌 MCQ Tip
✔ Every Primary Key is a Candidate Key
❌ Every Candidate Key is not Primary Key
🔥 One-Line Exam Facts
-
Primary key cannot be NULL
-
Foreign key can be NULL
-
One table → only one Primary Key
-
Multiple Candidate Keys possible
📐 PART 2: NORMALIZATION (VERY HIGH WEIGHTAGE)
🔹 What is Normalization?
👉 Process of removing redundancy and avoiding anomalies
🧠 Memory Line:
“N R A” → No Redundancy, Avoid Anomaly
🔹 Types of Anomalies (1 MCQ sure)
| Type | Meaning |
|---|---|
| Insert Anomaly | Cannot insert data |
| Update Anomaly | Update in many places |
| Delete Anomaly | Data loss |
🔹 Normal Forms (ULTRA IMPORTANT)
✅ 1NF (First Normal Form)
✔ No multivalued attributes
✔ Atomic values only
❌ {Maths, Science} → Wrong
✔ Maths, Science → Correct
✅ 2NF
✔ Must be in 1NF
✔ No Partial Dependency
🧠 Trick:
Partial dependency occurs only when PK is composite
✅ 3NF (MOST ASKED)
✔ Must be in 2NF
✔ No Transitive Dependency
🧠 Trick:
Non-key → Non-key = Transitive (❌)
🔥 Normalization Summary (MEMORIZE)
| NF | Removes |
|---|---|
| 1NF | Multivalued |
| 2NF | Partial dependency |
| 3NF | Transitive dependency |
📌 Exam Fact:
👉 3NF is sufficient for most databases
🧮 PART 3: SQL (GUARANTEED MARKS)
🔹 SQL Categories (MCQ FAVORITE)
| Type | Commands |
|---|---|
| DDL | CREATE, DROP, ALTER |
| DML | INSERT, UPDATE, DELETE |
| DQL | SELECT |
| DCL | GRANT, REVOKE |
| TCL | COMMIT, ROLLBACK |
🧠 Trick:
DDL–DML–DCL–TCL
🔹 Important SQL Commands
SELECT
WHERE
GROUP BY
👉 Used with aggregate functions
HAVING
👉 Works after GROUP BY
📌 MCQ Trap
-
❌ WHERE with aggregate → Wrong
-
✔ HAVING with aggregate → Correct
🔹 Aggregate Functions (VERY IMPORTANT)
| Function | Meaning |
|---|---|
| COUNT() | Number |
| SUM() | Total |
| AVG() | Average |
| MAX() | Maximum |
| MIN() | Minimum |
🔥 SQL JOIN (1–2 MCQ sure)
| Join | Meaning |
|---|---|
| INNER JOIN | Common records |
| LEFT JOIN | All left + matched |
| RIGHT JOIN | All right + matched |
| FULL JOIN | All records |
🧠 Trick:
LEFT → Left table full
🧩 PART 4: RELATIONAL ALGEBRA (CONCEPTUAL MCQs)
🔹 What is Relational Algebra?
👉 Procedural query language
👉 Uses operators
🔹 Important Operators (MUST REMEMBER)
| Symbol | Operator |
|---|---|
| σ | Selection |
| π | Projection |
| ∪ | Union |
| − | Set Difference |
| × | Cartesian Product |
| ⨝ | Join |
🔹 Examples (VERY SIMPLE)
Selection
Projection
📌 MCQ Tip
-
Selection → Rows
-
Projection → Columns
🎯 FINAL EXAM MEMORY SHEET (REVISE DAILY)
🔑 Keys
✔ Primary = Unique + Not Null
✔ Foreign = Reference
📐 Normalization
✔ 1NF → Atomic
✔ 2NF → No Partial
✔ 3NF → No Transitive
🧮 SQL
✔ WHERE ≠ HAVING
✔ GROUP BY → Aggregate
🧩 Relational Algebra
✔ σ → Rows
✔ π → Columns
Comments
Post a Comment